<template>
  <div id="app">
    <!-- <v-scale-screen width="1920" height="1080" :full-screen="false"> -->
    <router-view />
    <!-- </v-scale-screen> -->
  </div>
</template>

<script>
import { getToken } from '@/utils/auth'
export default {
  name: 'App',
  created() {
    window.addEventListener('keydown', this.handkeyCode, true)
  },
  methods: {
    handkeyCode(e) {
      console.log('11111', e);
      if (e.keyCode === 32) {
        console.log('空格');
        let full = document.fullscreenElement;
        if (!full) {
          // 文档根节点的方法requestFullscreen（）实现全屏模式
          document.documentElement.requestFullscreen();
        } else {
          // 文档根节点的方法exitFullscreen（）退出全屏
          document.exitFullscreen()
        }
      }
      if (e.ctrlKey && e.key === 'q') {
        if (!getToken()) return
        e.preventDefault(); // 阻止默认行为
        this.$confirm(
          '即将退出登录，是否继续?',
          '警告',
          {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }
        ).then(() => {
          this.$store.dispatch('user/logOut').then(() => {
            this.$router.push('/login')
          })
        }).catch((err) => {

        })
      }
    }
  }
}
</script>
